package com.globallogic.jira.report.hierarchyreport;

import java.util.Map;

import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.plugin.report.impl.AbstractReport;
import com.atlassian.jira.web.action.ProjectActionSupport;

/**
 * Class <b>LinkHierarchyReport</b> creates hierarchy report
 * 
 * @author anton.pereverziev
 * @author egor.chumakov
 * 
 */
public class LinkHierarchyReport extends AbstractReport {
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public String generateReportHtml(ProjectActionSupport projectActionSupport,
	    Map map) throws Exception {
	Long pid = Long.parseLong((String) map.get("selectedProjectId"));
	if (map.get("includeSubtasks") == null)
	    map.put("includeSubtasks", "false");
	if (map.get("includeOrphans") == null)
	    map.put("includeOrphans", "false");
	String projectName = ComponentManager.getInstance().getProjectManager()
		.getProjectObj(pid).getName();
	map.put("projectName", projectName);
	return descriptor.getHtml("reportView", map);
    }
}
